home *** CD-ROM | disk | FTP | other *** search
/ GFX Sensations 1 / Graphic Sensations - Volume 1.iso / tools / amiga / 3d_tools / irit40s.lha / Irit / cagd_lib / cagd_err.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-30  |  3.9 KB  |  77 lines

  1. /******************************************************************************
  2. * Cagd_err.c - handler for all cagd library fatal errors.              *
  3. *******************************************************************************
  4. * Written by Gershon Elber, May. 91.                          *
  5. ******************************************************************************/
  6.  
  7. #include "cagd_loc.h"
  8.  
  9. typedef struct CagdErrorStruct {
  10.     CagdFatalErrorType ErrorNum;
  11.     char *ErrorDesc;
  12. } CagdErrorStruct;
  13.  
  14. static CagdErrorStruct ErrMsgs[] =
  15. {
  16.     { CAGD_ERR_180_ARC,            "Attempt to construct a 180 degrees arc" },
  17.     { CAGD_ERR_AFD_NO_SUPPORT,        "No support for such AFD operation." },
  18.     { CAGD_ERR_ALLOC_ERR,        "Memory allocation error" },
  19.     { CAGD_ERR_BSPLINE_NO_SUPPORT,    "Bspline basis type is not supported" },
  20.     { CAGD_ERR_BZR_CRV_EXPECT,        "Bezier curve is expected" },
  21.     { CAGD_ERR_BZR_SRF_EXPECT,        "Bezier surface is expected" },
  22.     { CAGD_ERR_CRV_FAIL_CMPT,        "Cannot make curves compatible" },
  23.     { CAGD_ERR_CRVS_INCOMPATIBLE,    "Curves for requested operation are incompatible" },
  24.     { CAGD_ERR_CUBIC_EXPECTED,        "Cubic polynomial expected." },
  25.     { CAGD_ERR_DEGEN_ALPHA,        "Degenerated Alpha matrix" },
  26.     { CAGD_ERR_DIR_NOT_CONST_UV,    "Dir is not one of CONST_U/V_DIR" },
  27.     { CAGD_ERR_INDEX_NOT_IN_MESH,    "Index is out of mesh range" },
  28.     { CAGD_ERR_KNOT_NOT_ORDERED,    "Provided knots are not in ascending order" },
  29.     { CAGD_ERR_LIN_NO_SUPPORT,        "Order below linear is not supported" },
  30.     { CAGD_ERR_NO_CROSS_PROD,        "No cross product for scalar surface" },
  31.     { CAGD_ERR_NOT_ENOUGH_MEM,        "Not enough memory, exit" },
  32.     { CAGD_ERR_NOT_IMPLEMENTED,        "Not implemented" },
  33.     { CAGD_ERR_NUM_KNOT_MISMATCH,    "Number of knots does not match" },
  34.     { CAGD_ERR_OUT_OF_RANGE,        "Data is out of range." },
  35.     { CAGD_ERR_PARSER_STACK_OV,        "Parser Internal stack overflow.." },
  36.     { CAGD_ERR_POWER_NO_SUPPORT,    "Power basis type is not supported" },
  37.     { CAGD_ERR_PT_OR_LEN_MISMATCH,    "Curve PtType or Length mismatch surface" },
  38.     { CAGD_ERR_RATIONAL_EXPECTED,    "Rational Crv/Srf expected." },
  39.     { CAGD_ERR_SCALAR_EXPECTED,        "Scalar entity expected" },
  40.     { CAGD_ERR_SRF_FAIL_CMPT,        "Cannot make surfaces compatible" },
  41.     { CAGD_ERR_SRFS_INCOMPATIBLE,    "Surfaces for requested operation are incompatible" },
  42.     { CAGD_ERR_T_NOT_IN_CRV,        "Given t is not in curve parametric domain" },
  43.     { CAGD_ERR_U_NOT_IN_SRF,        "Given u is not in u surface parametric domain" },
  44.     { CAGD_ERR_UNDEF_CRV,        "Undefined curve type" },
  45.     { CAGD_ERR_UNDEF_SRF,        "Undefined surface type" },
  46.     { CAGD_ERR_UNSUPPORT_PT,        "Unsupported point type" },
  47.     { CAGD_ERR_V_NOT_IN_SRF,        "Given v is not in v surface parametric domain" },
  48.     { CAGD_ERR_W_NOT_SAME,        "Weights are not identical" },
  49.     { CAGD_ERR_WRONG_CRV,        "Provided curve type is wrong" },
  50.     { CAGD_ERR_WRONG_INDEX,        "Provided index is wrong" },
  51.     { CAGD_ERR_WRONG_ORDER,        "Provided order is wrong" },
  52.     { CAGD_ERR_WRONG_SRF,        "Provided surface type is wrong" },
  53.     { CAGD_ERR_WRONG_PT_TYPE,        "Provided point type is wrong" },
  54.     { CAGD_ERR_CANNOT_COMP_NORMAL,    "Cannot compute normal" },
  55.     { CAGD_ERR_REPARAM_NOT_MONOTONE,    "Reparametrization is not monotone" },
  56.     { CAGD_ERR_RATIONAL_NO_SUPPORT,    "Rational function is not supported" },
  57.     { CAGD_ERR_NO_SOLUTION,        "No solution" },
  58.     { CAGD_ERR_TOO_COMPLEX,        "Too complex" },
  59.     { CAGD_ERR_REF_LESS_ORIG,        "Refined object smaller than original" },
  60.     { CAGD_ERR_ONLY_2D_OR_3D,        "Only two or three dimensions are supported" },
  61.     { CAGD_ERR_UNDEFINE_ERR,        NULL }
  62. };
  63.  
  64. /******************************************************************************
  65. * Returns a string describing a the given error.                  *
  66. ******************************************************************************/
  67. char *CagdDescribeError(CagdFatalErrorType ErrorNum)
  68. {
  69.     int i = 0;
  70.  
  71.     for ( ; ErrMsgs[i].ErrorDesc != NULL; i++)
  72.     if (ErrorNum == ErrMsgs[i].ErrorNum)
  73.         return ErrMsgs[i].ErrorDesc;
  74.  
  75.     return "Undefined error";
  76. }
  77.